package com.oygo.hunter.utils;

import android.app.ActivityManager;
import android.content.Context;
import android.os.Process;
import android.util.Log;

import com.oygo.hunter.decode.DecodeWrapper;

public class ProcessUtils {
    public static boolean p_float = false;
    public static boolean p_package = false;
    public static String p_private = null;
    public static boolean p_throws = false;
    public static boolean p_volatile = false;

    static {
    }

    public static String getProcessName(Context arg4) {
        int v0 = Process.myPid();
        ActivityManager v4 = (ActivityManager)arg4.getSystemService(Context.ACTIVITY_SERVICE);
        if(v4 == null) {
            return null;
        }

        for(Object v2: v4.getRunningAppProcesses()) {
            ActivityManager.RunningAppProcessInfo v2_1 = (ActivityManager.RunningAppProcessInfo)v2;
            if(v2_1.pid != v0) {
                continue;
            }

            return v2_1.processName;
        }

        return null;
    }

    public static void init(Context arg4) {
        if(!ProcessUtils.p_throws) {
            String v0 = ProcessUtils.getProcessName(arg4);
            String v1 = arg4.getPackageName();
            Log.d("cql","init is:"+DecodeWrapper.package_decode1("LvLtYIE/zonUVjQhmeLX0Q=="));
            Log.d("cql","init2 is:"+DecodeWrapper.package_decode1("lW6LtSOc8R/XPbbsJoA7UA=="));
            ProcessUtils.p_private = v0;
            if(arg4.getPackageName().equals(v0)) {
                ProcessUtils.p_package = true;
            }
            else {
                if(v0 != null && (v0.equals(v1 + DecodeWrapper.package_decode1("LvLtYIE/zonUVjQhmeLX0Q==")))) {
                    ProcessUtils.p_float = true;
                }

                if(v0 != null && (v0.equals(v1 + DecodeWrapper.package_decode1("lW6LtSOc8R/XPbbsJoA7UA==")))) {
                    ProcessUtils.p_volatile = true;
                }
            }

            ProcessUtils.p_throws = true;
        }
    }


}
